﻿using System;
using System.Html.DOM;

namespace jQueryLib
{
    partial class JQuery
    {
        public static string Trim(string str)
        {
            return null;
        }

        public readonly static object Support;

        /// <summary>
        /// Return a number representing the current time.
        /// </summary>
        /// <returns></returns>
        public static long Now()
        {
            return 0;
        }

        /// <summary>
        /// Translate all items in an array or object to new array of items.
        /// </summary>
        /// <param name="array">The Array to translate.</param>
        /// <param name="func">object func(element, idx)</param>
        /// <returns></returns>
        public static R[] Map<T, R>(T[] array, Func<R, T, int> func)
        {
            return null;
        }

        /// <summary>
        /// Translate all items in an array or object to new array of items.
        /// </summary>
        /// <param name="arrayOrObject">The Array/Object to translate.</param>
        /// <param name="func">object func(value, keyOrIndex)</param>
        /// <returns></returns>
        public static R[] Map<R>(object arrayOrObject, Func<R, object, object> func)
        {
            return null;
        }

        /// <summary>
        /// Convert an array-like object into a true JavaScript array.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static Array MakeArray(Object obj)
        {
            return null;
        }

        public static bool IsWindow(object obj)
        {
            return false;
        }

        /// <summary>
        /// Check to see if an object is a plain object (created using "{}" or "new Object").
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static bool IsPlainObject(object obj)
        {
            return false;
        }

        public static bool IsNumeric(object obj)
        {
            return false;
        }

        public static bool IsFunction(object obj)
        {
            return false;
        }

        /// <summary>
        /// Check to see if an object is empty (contains no properties).
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static bool IsEmptyObject(object obj)
        {
            return false;
        }

        public static bool IsArray(object obj)
        {
            return false;
        }

        /// <summary>
        /// Check to see if a DOM element is within another DOM element.
        /// </summary>
        /// <param name="container"></param>
        /// <param name="contained"></param>
        /// <returns></returns>
        public static bool Contains(HtmlElement container, HtmlElement contained)
        {
            return false;
        }

        /// <summary>
        /// Search for a specified value within an array and return its index (or -1 if not found).
        /// </summary>
        /// <param name="val"></param>
        /// <param name="arr"></param>
        /// <returns></returns>
        public static bool InArray(object val, Array arr)
        {
            return false;
        }

        /// <summary>
        /// Search for a specified value within an array and return its index (or -1 if not found).
        /// </summary>
        /// <param name="val"></param>
        /// <param name="arr"></param>
        /// <param name="fromIdx"></param>
        /// <returns></returns>
        public static bool InArray(object val, Array arr, int fromIdx)
        {
            return false;
        }

        /// <summary>
        /// Finds the elements of an array which satisfy a filter function. The original array is not affected.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="R"></typeparam>
        /// <param name="arr"></param>
        /// <param name="func"></param>
        /// <returns></returns>
        public static R[] Grep<T, R>(T[] arr, Func<R, T, int> func)
        {
            return null;
        }

        /// <summary>
        /// Finds the elements of an array which satisfy a filter function. The original array is not affected.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="R"></typeparam>
        /// <param name="arr"></param>
        /// <param name="func">in function, "this" will be the global window object.</param>
        /// <param name="invert">If "invert" is false, or not provided, then the function returns an array consisting of all elements for which "callback" returns true. If "invert" is true, then the function returns an array consisting of all elements for which "callback" returns false.</param>
        /// <returns></returns>
        public static R[] Grep<T, R>(T[] arr, Func<R, T, int> func, bool invert)
        {
            return null;
        }

        /// <summary>
        /// Merge the contents of two or more objects together into the first object.
        /// </summary>
        /// <param name="target"></param>
        /// <param name="obj"></param>
        /// <param name="more"></param>
        /// <returns></returns>
        public static object Extend(object target, object obj, params object[] more)
        {
            return null;
        }

        /// <summary>
        /// Merge the contents of two or more objects together into the first object.
        /// </summary>
        /// <param name="deep">If true, the merge becomes recursive (aka. deep copy).</param>
        /// <param name="target"></param>
        /// <param name="obj"></param>
        /// <param name="more"></param>
        /// <returns></returns>
        public static object Extend(bool deep, object target, object obj, params object[] more)
        {
            return null;
        }

        /// <summary>
        /// Merge the contents of two arrays together into the first array.
        /// </summary>
        /// <param name="arr1"></param>
        /// <param name="arr2"></param>
        /// <returns></returns>
        public static T[] Merge<T>(T[] arr1, T[] arr2)
        {
            return null;
        }

        /// <summary>
        /// Check to see if a DOM node is within an XML document (or is an XML document).
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public static bool IsXMLDoc(HtmlElement element)
        {
            return false;
        }

        /// <summary>
        /// You can use this empty function when you wish to pass around a function that will do nothing.
        /// </summary>
        public static void Noop()
        {
        }

        /// <summary>
        /// Takes a well-formed JSON string and returns the resulting JavaScript object.
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static object ParseJSON(string data)
        {
            return null;
        }

        /// <summary>
        /// Parses a string into an array of DOM nodes.
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static HtmlElement[] ParseHTML(string data, object context= null, bool keepScripts = false)
        {
            return null;
        }

        /// <summary>
        /// Parses a string into an XML document.
        /// </summary>
        /// <param name="data">a well-formed XML string to be parsed</param>
        /// <returns></returns>
        public static object ParseXML(string data)//TODO:return a xmldoc.
        {
            return null;
        }

        /// <summary>
        /// Determine the internal JavaScript [[Class]] of an object.
        /// </summary>
        /// <param name="obj">Object to get the internal JavaScript [[Class]] of.</param>
        /// <returns></returns>
        public static string Type(object obj = null)
        {
            return null;
        }

        /// <summary>
        /// Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.
        /// </summary>
        /// <param name="array">The Array of DOM elements.</param>
        /// <returns></returns>
        public static HtmlElement[] Unique(HtmlElement[] array)
        {
            return null;
        }
    }
}
